/**
 * Created with JetBrains PhpStorm.
 * User: jiangshuguang
 * Date: 14-9-27
 * Time: 下午4:22
 * To change this template use File | Settings | File Templates.
 */
exports.summary = function(){
    var ShareTip = require("wap_common:widget/ui/sharetip/sharetip.js").ShareTip,
        util = require("wap_common:widget/ui/libs/util.js").util,
        $page = $(".widget-summary"),
        $tip = $page.find(".tip"),
        $username = $page.find(".phone"),
        $phoneBtn = $page.find(".btn-phone"),
        $btnShare = $page.find(".btn-share"),
        sharetip = new ShareTip();

    function tipShow(text){
        $tip.css("visibility","visible").text(text);
    }

    $phoneBtn.on("touchstart",function(){
        if(!($(this).hasClass("btn-disable"))){
            var username = $.trim($username.val());
            if(util.checkPhone(username)){
                location.href="/activity/register?" +
                    "open_id="+$(this).attr("data-open-id")+
                    "&phone="+username+
                    "&register_from="+$(this).attr("data-register-from")
            }else{
                tipShow("手机号码输入错误");
            }
        }
    });

    $btnShare.on("click",function(){
        sharetip.showShare();
    });

};